package com.example.mapper;

import com.example.params.ClazzQueryParam;
import com.example.pojo.Clazz;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {
    List<Clazz> getAllClazz(ClazzQueryParam clazzQueryParam);
    @Delete("delete from clazz where id=#{id}")
    int deleteClazzById(Integer id);
    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject) values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject})")
    int addClazz(Clazz clazz);
    @Select("select * from clazz where id=#{id}")
    Clazz getClazzById(Integer id);

    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId},subject=#{subject} where id=#{id}")
    int updateClazz(Clazz clazz);
    @Select("select * from clazz")
    List<Clazz> getAll();
}
